package com.centerm.common.constant.enums.operation;

import com.centerm.common.constant.StatusCode;

/**
* @Description
* 	LOW(0, "低"),<br />
	MIDDLE(1, "中"),<br />
	HIGH(2, "高"),<br />
	DANGER(3, "极高"),<br />
* @author Fly
* @date 2017年8月9日
 */
public enum LevelType implements StatusCode {
	LOW(0, "低"),
	MIDDLE(1, "中"),
	HIGH(2, "高"),
	DANGER(3, "极高"),
	;
	
	private Integer code;
	private String description;
	
	
	LevelType(Integer code, String description) {
		this.code = code;
		this.description = description;
	}


	@Override
	public Integer getCode() {
		return this.code;
	}


	@Override
	public String getDescription() {
		return this.description;
	}

	public static StatusCode getByCode(Integer code) {
		for(LevelType levelType : LevelType.values()) {
            if(levelType.getCode().equals(code)) {
                return levelType;
            }
        }
        return null;
	}


	public static String getDescriptionByCode(Integer code) {
		for(LevelType levelType : LevelType.values()) {
            if(levelType.getCode().equals(code)) {
                return levelType.getDescription();
            }
        }
        return null;
	}
}
